public class ZhaiZhiJie5
{
    public static void main(String[] args)
    {
        func1();
        func2();
        func3();
        func4();
        func5();
        func6();
    }
    public static void func1()
    {
        String str = "Java技术学习班20070326";
        char[] c = str.toCharArray();
        int countB = 0;//记录起始位置
        int countE = 0;//记录终止位置
        for(int i = 0; i < c.length; i++)
        {
            if(c[i] >= '0' && c[i] <= '9')
            {
                if(countB == 0)
                    countB = i;
                countE = i;
            }
            else
            {
                if(countB != 0)
                    break;
            }
        }
        System.out.println(str.substring(countB,countE+1));
    }

    public static void func2()
    {
        String str = "MLDN JAVA";
        System.out.println(str.replaceAll("JAVA", "J2EE"));
    }

    public static void func3()
    {
        String str = "Java技术学习班20070326";
        System.out.println(str.charAt(8));
    }

    public static void func4()
    {
        String str = "Java技术学习班20070326";
        System.out.println(str.replaceAll("0", ""));
    }

    public static void func5()
    {
        String str = "Java 技术学习班20070326MLDN 老师";
        System.out.println(str.replaceAll(" ", ""));
    }

    public static void func6()
    {
        String str = "123456200703271234";
        System.out.println(str.substring(6,14));
    }
}
